//
//  receiveChatReceipt.m
//  tcpoctest
//
//  Created by gump on 6/14/13.
//  Copyright (c) 2013 gump. All rights reserved.
//

#import "receiveChatReceipt.h"
#import "sendMessageReceipt.h"

#import "chatDataSource.h"
#import "ChatContentInfo.h"
#import "chatuserdb.h"

@implementation receiveChatReceipt

-(void)processreceive
{
    //发送者 返回 16char(1),16char(1),
    //消息ID长度char(1),消息ID长度char(x)
    
    NSString *strid = [logicsb ReadUnencodeString];
    NSString *strtime = [logicsb ReadUnencodeString];
    
    ChatContentInfo *ccinfo = [[DataControl shareControl].chatDS getChatInfoBySequence:
                               [LogicControl sharedLogicControl].icurSequence];
    if (ccinfo != nil) {
        ccinfo.strid = strid;
        ccinfo.strChatDate = strtime;
        ccinfo.ichatReadState = CRS_SENDSUCCESS;
        
        [[DataControl shareControl].chatDS addChatInfo:ccinfo withID:strid];
        
        [[DataBaseCtrol shareControl].chatuserdatabase UpdateChatID:ccinfo];
        [[DataBaseCtrol shareControl].chatuserdatabase UpdateChatState:ccinfo];
        
        [[DataControl shareControl].UICommendDS addUICommand:UC_CHAT_REFRESH];
    }
    
    [self ShowLog];
}

@end
